import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import electron from "vite-plugin-electron";
import {
    resolve
} from "path"

// https://vite.dev/config/
export default defineConfig({
  plugins: [
      vue(),
      vueJsx(),
      electron([
          {
              // 主进程入口
              entry: "src/electron/main/index.ts",
              vite: {
                  build: {
                      outDir: 'dist-electron/main',
                  },
                  resolve: {
                      alias: {
                          "@main": resolve(__dirname, "./src/electron/main")
                      }
                  }
              }
          },
          {
              // 渲染进程入口
              entry: 'src/electron/preload/index.ts',
              vite: {
                  build: {
                      outDir: 'dist-electron/preload'
                  }
              }
          }
      ])
  ],
  resolve: {
      alias: {
          "@render": resolve(__dirname, "./src/render"),
          "@main": resolve(__dirname, "./src/electron/main")
      }
  }
})
